#define CPR_SECURE_NO_WARNINGS
#include<stdio.h>


void bubblesort(int*arr,int sz)
{
	int swap = 0;
	for (int i = 0; i < sz - 1; i++)
	{
		for (int n = 0; n < sz - i-1; n++)
		{
			if ((*(arr + n)) >= (*(arr + n + 1)))
			{
				swap = *(arr + n);
				*(arr + n) = *(arr + n + 1);
				*(arr + n + 1) = swap;
			}
		}
	}
}

void print(int* arr, int sz)
{
	for (int i = 0; i < sz; i++)
	{
		printf("%d ", * (arr + i));
	}
}
int main()
{
	int sz;
	int arr[9] = { 1,9,2,8,3,7,4,6,5 };
	sz = (sizeof(arr) / sizeof(arr[0]));
	bubblesort(arr, sz);
	print(arr, sz);
	return 0;
}